package benchmark.energy.tx;

import benchmark.transaction.definition.AbstractTransaction;

import java.util.List;

public class ImportStaticDataTx extends AbstractTransaction {
    private List<EnergyNode> nodes;
    private List<EnergyRel> rels;

    // This constructor is used while generating benchmarks.
    public ImportStaticDataTx(List<EnergyNode> nodes, List<EnergyRel> rels) {
        this.setTxType(TxType.TX_IMPORT_STATIC_DATA);
        this.nodes = nodes;
        this.rels = rels;
        Metrics m = new Metrics();
        m.setReqSize(nodes.size() + rels.size());
        this.setMetrics(m);
    }

    public ImportStaticDataTx() {
    }

    public List<EnergyNode> getNodes() {
        return nodes;
    }

    public void setNodes(List<EnergyNode> nodes) {
        this.nodes = nodes;
    }

    public List<EnergyRel> getRels() {
        return rels;
    }

    public void setRels(List<EnergyRel> rels) {
        this.rels = rels;
    }


    public static class EnergyNode {
        private int rawId; //节点编号，原始数据中缺失20个
        private String name;
        private String country;
        private int voltage;
        private float latitude;
        private float longitude;

        public int getRawId() {
            return rawId;
        }

        public void setRawId(int rawId) {
            this.rawId = rawId;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getCountry() {
            return country;
        }

        public void setCountry(String country) {
            this.country = country;
        }

        public int getVoltage() {
            return voltage;
        }

        public void setVoltage(int voltage) {
            this.voltage = voltage;
        }

        public float getLatitude() {
            return latitude;
        }

        public void setLatitude(float latitude) {
            this.latitude = latitude;
        }

        public float getLongitude() {
            return longitude;
        }

        public void setLongitude(float longitude) {
            this.longitude = longitude;
        }
    }

    public static class EnergyRel {
        private int fromRawId;
        private int toRawId;
        private float x; //电抗
        private float y; //电纳
        private int limit; //传输极限
        private float length; //线路长度

        public int getFromRawId() {
            return fromRawId;
        }

        public void setFromRawId(int fromRawId) {
            this.fromRawId = fromRawId;
        }

        public int getToRawId() {
            return toRawId;
        }

        public void setToRawId(int toRawId) {
            this.toRawId = toRawId;
        }

        public float getX() {
            return x;
        }

        public void setX(float x) {
            this.x = x;
        }

        public float getY() {
            return y;
        }

        public void setY(float y) {
            this.y = y;
        }

        public int getLimit() {
            return limit;
        }

        public void setLimit(int limit) {
            this.limit = limit;
        }

        public float getLength() {
            return length;
        }

        public void setLength(float length) {
            this.length = length;
        }
    }
}
